test_runner: add exports option to mock.module#61727
test_runner: add exports option to mock.module#61727Han5991 wants to merge 1 commit intonodejs:mainfrom
Conversation
|
Review requested:
|
3d95c0c to
fa99ada
Compare
|
Related: #58443 (I haven't read through this PR yet though) |
I was working on it with that in mind. |
73c4cf1 to
715c12c
Compare
|
Yes, sounds good go me! It would be ideal (but not required or anything) to land this with a userland migration ready to go. I think it could be done fairly easily. Cc @Ceres6 this should make your Jest → node:test migration easier 🙂 |
|
Thanks for the feedback. I will scope this PR to Step 2 of the plan: introduce |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #61727 +/- ##
==========================================
- Coverage 89.73% 89.73% -0.01%
==========================================
Files 675 675
Lines 204525 204608 +83
Branches 39310 39330 +20
==========================================
+ Hits 183529 183596 +67
+ Misses 13287 13286 -1
- Partials 7709 7726 +17
🚀 New features to boost your workflow:
|
715c12c to
424675e
Compare
Add options.exports support in mock.module() and normalize option shapes through a shared exports path. Keep defaultExport and namedExports as aliases, emit runtime deprecation warnings for legacy options, and update docs and tests, including output fixtures and coverage snapshots. Refs: nodejs#58443
424675e to
0498de3
Compare
Summary
mock.module(..., { exports })and normalize option shapes through a shared exports pathdefaultExportandnamedExportsas aliases, and emit runtimeDeprecationWarningwhen legacy options are usedLegacy Option Mixing Behavior
options.exportswith legacy options is currently allowed.Scope
defaultExport+namedExportsintoexports#58443 plan.Testing
make lint-jspython3 tools/test.py test/parallel/test-runner-module-mocking.jspython3 tools/test.py test/test-runner/test-output-coverage-with-mock.mjs test/test-runner/test-output-typescript-coverage.mjsRefs: #58443